package com.qcby.controller;

import com.qcby.entity.PageResult;
import com.qcby.entity.Query.ShopAduitQuery;
import com.qcby.entity.Result;
import com.qcby.entity.Shop;
import com.qcby.entity.ShopAduit;
import com.qcby.service.ShopAduitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/shopAduit")
public class ShopAduitController {
    @Autowired
    private ShopAduitService shopAduitService;
    @RequestMapping("/list")
    public Result list(ShopAduitQuery shopAduitQuery){
        PageResult<ShopAduit> list = shopAduitService.list(shopAduitQuery);
        return Result.success(list);
    }
    @RequestMapping("/approve")
    public Result approve(@RequestParam("id") Integer id,@RequestParam("name") String name,@RequestParam("aduitDesc") String aduitDesc){
        shopAduitService.approve(id,name,aduitDesc);
        return Result.success();
    }
    @RequestMapping("/reject")
    public Result reject(@RequestParam("id") Integer id,@RequestParam("name") String name,@RequestParam("aduitDesc") String aduitDesc){
        shopAduitService.reject(id,name,aduitDesc);
        return Result.success();
    }
    @RequestMapping("/getShopAduitById")
    public Result getShopAduitById(@RequestParam("id") Integer id){
        ShopAduit shopAduit = shopAduitService.getById(id);
        return Result.success(shopAduit);
    }
    @RequestMapping("/add")
    public Result add(Shop shop){
        System.out.println(shop+"shop店铺是什么");
        shopAduitService.add(shop);
        return Result.success();
    }

}
